package com.qfmy.app.controller.common;

import com.qfmy.app.service.common.FileUploadService;
import com.qfmy.common.result.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RequestMapping("/app/file")
@RestController
@SuppressWarnings("all")
public class FileUploadController {

		@Resource
		private FileUploadService fileUploadService;

		/**
		*文件上传方法
		*/
		@PostMapping("/upload")
		public Result<String> upload(@RequestParam MultipartFile file) throws Exception {
			// 上传文件
			String url = fileUploadService.upload(file);
			return Result.ok(url);
	}
}
